package org.apache.flink.runtime.resourceprovider;

import java.util.Collection;
import java.util.concurrent.CompletableFuture;

import org.apache.flink.api.common.time.Time;
import org.apache.flink.runtime.messages.ThreadInfoResponse;
import org.apache.flink.runtime.resourceconsumer.ConsumeAttemptID;
import org.apache.flink.runtime.rpc.RpcTimeout;
import org.apache.flink.runtime.rpc.threadinfo.ThreadInfoSamplesRequest;

/** RPC gateway for requesting {@link org.apache.flink.runtime.messages.ThreadInfoSample}. */
public interface ResourceProviderThreadInfoGateway {

    /**
     * Request a thread info sample from the given tasks.
     *
     * @param taskExecutionAttemptIds identifying the task to sample
     * @param requestParams parameters of the request
     * @param timeout of the request
     * @return Future of stack trace sample response
     */
    CompletableFuture<ThreadInfoResponse> requestThreadInfoSamples(
            Collection<ConsumeAttemptID> taskExecutionAttemptIds,
            ThreadInfoSamplesRequest requestParams,
            @RpcTimeout Time timeout);
}
